// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   ContentTypeUtil.java

package com.hfstu.file.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class ContentTypeUtil
{

	private Properties contentTypeProps;
	private Set inlineSet;
	private static ContentTypeUtil _instance;
	private Logger _log;

	public ContentTypeUtil()
	{
		inlineSet = new HashSet();
		_log = LoggerFactory.getLogger(com/hfstu/file/utils/ContentTypeUtil);
	}

	public static ContentTypeUtil getInstance()
	{
		if (_instance == null)
			synchronized (com/hfstu/file/utils/ContentTypeUtil)
			{
				if (_instance == null)
				{
					_instance = new ContentTypeUtil();
					_instance.init();
				}
			}
		return _instance;
	}

	private void init()
	{
		InputStream inputStream;
		contentTypeProps = new Properties();
		inputStream = getClass().getClassLoader().getResourceAsStream("conf-fileserver/contentType.properties");
		if (inputStream == null)
		{
			_log.error("contentType.properties load error.");
			return;
		}
		try
		{
			contentTypeProps.load(inputStream);
			break MISSING_BLOCK_LABEL_114;
		}
		catch (IOException e)
		{
			_log.error("contentType.properties load error.", e);
		}
		try
		{
			inputStream.close();
		}
		catch (IOException e)
		{
			_log.error(e.getMessage());
		}
		return;
		Exception exception;
		exception;
		try
		{
			inputStream.close();
		}
		catch (IOException e)
		{
			_log.error(e.getMessage());
		}
		throw exception;
		try
		{
			inputStream.close();
		}
		catch (IOException e)
		{
			_log.error(e.getMessage());
		}
		String inline_type = contentTypeProps.getProperty("inline_type");
		if (inline_type != null)
		{
			String inlineArray[] = inline_type.split(",");
			String as[];
			int j = (as = inlineArray).length;
			for (int i = 0; i < j; i++)
			{
				String str = as[i];
				if (!StringUtils.isEmpty(str))
					inlineSet.add(str);
			}

		}
		return;
	}

	public Properties getProperties()
	{
		return contentTypeProps;
	}

	public boolean isInlineType(String suffix)
	{
		return inlineSet.contains(suffix);
	}
}
